﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            Pen mypen = new Pen(Color.Blue, 3);
            Point oo1 = new Point(30, this.ClientSize.Height - 100);
            Point oo2 = new Point(this.ClientSize.Width - 50, this.ClientSize.Height - 100);
            g.DrawLine(mypen, oo1, oo2);
            Point oo3 = new Point(30, 30);
            g.DrawLine(mypen, oo1, oo3);
            Font f=new Font("宋体",12,FontStyle.Bold );
            g.DrawString ("x",f,mypen .Brush ,oo2 );
            g.DrawString ("y",f,mypen .Brush ,10,10);
            int x1, x2, y1;
            double a, y2;
            x1 = x2 = 0;
            y1 = 0; y2 = this.ClientSize.Height - 100;
            for (x2 = 0; x2 < this.ClientSize.Width; x2++)
            {
                a =  2 * Math.PI * x2 / (this.ClientSize.Width);
                y2 = Math.Sin(a);
                y2 = (1 - y2) * (this.ClientSize.Height - 100) / 2;
                g.DrawLine(mypen, x1 + 30, (float)y1, x2 + 30, (float)y2);
                x1 =Convert.ToInt32( x2);
                y1 = Convert .ToInt32 ( y2);
            }
        }
    }
}
